﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/common.Master" AutoEventWireup="true" CodeBehind="Subject.aspx.cs" Inherits="pcsse.BBS.Subject" Title="讨论主题" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style4
        {
            width: 80px;
        }
    </style>
    <link href="../CSS/bbs.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="hoder_sidebar" runat="server">
    <asp:Panel ID="Panel1" runat="server">
        <li><asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">添加主题</asp:LinkButton></li>
    </asp:Panel>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="hoder_maincontent" runat="server">
    <div class="p_title">
互动讨论
</div>
    <asp:SiteMapPath ID="SiteMapPath1" runat="server" SkipLinkText="">
    </asp:SiteMapPath>
<asp:ListView ID="SubjectView1" runat="server" DataSourceID="SubjectDataSource" 
        DataKeyNames="ID" >
        <ItemTemplate>
            
            
             <div class="post_item">
                <div class="post_title">
                <a href='<%# "ShowPost.aspx?ID="+Eval("ID") %>'><%# Eval("SUBJECT") %></a>
                </div>
                <div class="txt">
                <%# Eval("DESCRIBE") %>
                </div>
                <div style="text-align:right;">发布于&nbsp;<%# Eval("TIME") %></div>
             </div>
            
          
        </ItemTemplate>
     
        <EmptyDataTemplate>
            <table id="Table2" runat="server" 
                
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                <tr>
                    <td>
                        未返回数据。</td>
                </tr>
            </table>
        </EmptyDataTemplate>
       
        <LayoutTemplate>
               <div ID="itemPlaceholder" runat="server">
                            </div>
        <div style="text-align:right">
                        <asp:DataPager ID="DataPager1" QueryStringField="p" runat="server" PageSize="5" PagedControlID="SubjectView1">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" FirstPageText="首页"  />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" LastPageText="末页" />
                            </Fields>
                        </asp:DataPager>
                        &nbsp;<a href="#" onclick="javascript:history.go(-1)">返回上一级</a>
                        </div>
        </LayoutTemplate>
      
    </asp:ListView>
<asp:ListView ID="SubjectView2" runat="server" DataSourceID="SubjectDataSource" 
        DataKeyNames="ID" Visible="False" >
        <ItemTemplate>
            <tr >
                <td>
                    <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                </td>
                <td>
                    <asp:LinkButton ID="SUBJECTLabel" runat="server" Text='<%# Eval("SUBJECT") %>'  PostBackUrl='<%# "ShowPost.aspx?ID="+Eval("ID") %>'/>
                </td>
                <td>
                    <asp:Label ID="DESCRIBELabel" runat="server" Text='<%# Eval("DESCRIBE") %>' />
                </td>
                <td>
                    <asp:Label ID="TIMELabel" runat="server" Text='<%# Eval("TIME") %>' />
                </td>
                <td>
                    <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Delete">删除</asp:LinkButton>
                </td>
                <td>
                    <asp:LinkButton ID="LinkButton5" runat="server" CommandName="Edit">修改</asp:LinkButton>
                </td>
            </tr>
        </ItemTemplate>
       
        <EmptyDataTemplate>
            <table runat="server" >
                <tr>
                    <td>
                        未返回数据。</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="itemPlaceholderContainer" runat="server" border="1">
                            <tr runat="server" >
                                <th runat="server">
                                    ID</th>
                                <th runat="server">
                                    主题</th>
                                <th runat="server">
                                    描述</th>
                                <th runat="server">
                                    发布时间</th>
                                <th runat="server">
                                    操作</th>
                            </tr>
                            <tr ID="itemPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" >
                        <asp:DataPager ID="DataPager1" runat="server">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <EditItemTemplate>
            <tr>
                <td>
                    <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="更新" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="取消" />
                </td>
                <td>
                    <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                </td>
                <td>
                    <asp:TextBox ID="SUBJECTTextBox" runat="server" 
                        Text='<%# Bind("SUBJECT") %>' />
                </td>
                <td>
                    <asp:TextBox ID="DESCRIBETextBox" runat="server" 
                        Text='<%# Bind("DESCRIBE") %>' />
                </td>
                <td>
                    <asp:TextBox ID="TIMEbox" runat="server" Text='<%# Bind("TIME") %>' />
                </td>
            </tr>
        </EditItemTemplate>
        
    </asp:ListView>
    <asp:SqlDataSource ID="SubjectDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:PCSSE %>" 
        SelectCommand="SELECT [ID],[SUBJECT], [DESCRIBE], [TIME] FROM [T_SUBJECT] ORDER BY [ID] DESC"
        DeleteCommand="DELETE FROM [T_SUBJECT] WHERE ([ID]=@ID)"
        UpdateCommand="UPDATE T_SUBJECT SET [SUBJECT]=@SUBJECT,[DESCRIBE]=@DESCRIBE,[TIME]=@TIME WHERE [ID]=@ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
    </asp:SqlDataSource>
    <div></div>
    <asp:Panel ID="Panel2" runat="server" Visible="False">
    
    <table id="table1">
    <tr>
    <td class="style4">
        <asp:Label ID="Label1" runat="server" Text="主题"></asp:Label></td>
    <td>
        <asp:TextBox ID="TextBox1" runat="server" Width="300px" Height="32px"></asp:TextBox></td>
    </tr>
    <tr>
    <td>
        <asp:Label ID="Label2" runat="server" Text="描述"></asp:Label></td>
    <td>
        <asp:TextBox ID="TextBox2" runat="server" Width="300px" Height="28px"></asp:TextBox></td>
    </tr>
    <tr>
    <td>
        <asp:Button ID="Button4" runat="server" Text="提交" onclick="Button4_Click" 
            Width="70px" /></td>
    <td>
        <input id="Reset1" type="reset" value="重置" style="font-size: medium" /></td>    
    </tr>
    </table>
    <% if (Convert.ToInt32(Session["Priority"].ToString()) > 2) Response.Write("<a href='ShowSignlist.aspx'>查看发言情况</a>"); %>
    </asp:Panel>
</asp:Content>
